<?php

namespace App\Http\Controllers\Api\v1;

use App\Dos\PayFactory;
use App\Dos\StoreDos;
use App\Server\JsonServer;
use Illuminate\Http\Request;

class Payment
{
    /**
     * 下支付订单
     * @param Request $request
     * @return array
     */
    public function payFunction(Request $request)
    {
        try {
            $orderNumber = $request->get('orderNumber');
            $payType = $request->get('type');
            $payFactory = PayFactory::payFactoryFunction($payType);

            $orderTime = StoreDos::payFunction((string)$orderNumber);
            if (!$orderTime) return JsonServer::fail('500', '未支付-订单超时', '');
        } catch (\Exception $exception) {
            return JsonServer::fail($exception->getMessage());
        }
    }

}
